﻿#define layout()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>jQuery手机微信转盘抽奖代码 - 站长素材</title>

<link href="../wx/cj/choujiang2/css/mui.min.css" rel="stylesheet">
<link href="../wx/cj/choujiang2/css/component.css" rel="stylesheet" type="text/css">
<link href="../wx/cj/choujiang2/css/award.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="../wx/cj/choujiang2/css/animate.min.css">

</head>
<body>
<input type="hidden" name="gamed" id="gamed" value="{{gamed}}" />
<input type="hidden" name="gameState" id="gameState" value="{{gameState}}" />
<input type="hidden" name="cardCode" id="cardCode" value="{{cardCode}}" />
<input type="hidden" name="mId" id="mId" value="{{mId}}" />
<!-------------抽奖页面-------------->
<div class="ml-main" id="ml-main">
	<img class="main_back" src="../wx/cj/choujiang2/img/back.png">
	<img class="animated zoomIn img_2_1" src="../wx/cj/choujiang2/img/img_1.png">
	<img class="animated bounceIn img_2_2" src="../wx/cj/choujiang2/img/img_2.png">
	<div class="kePublic">
		<!--转盘效果开始-->
		<div style="margin:0 auto">
			<div class="banner">
				<div class="turnplate" style="background-image:url(../wx/cj/choujiang2/img/turnplate-bg_2.png);background-size:100% 100%;font-size:24px !important;">
					<canvas class="item" id="wheelcanvas" width="516" height="516"></canvas>
					<img id="tupBtn" class="pointer" src="../wx/cj/choujiang2/img/turnplate-pointer_2.png">
				</div>
			</div>
		</div>
		<!--转盘效果结束-->
		<div class="clear"></div>
	</div>
	<img class="bottom_shadow" src="../wx/cj/choujiang2/img/bottom_shadow.png">
	<img class="animated zoomIn kePublic_back" src="../wx/cj/choujiang2/img/back1.png">
	
	<!--------------滚动中奖纪录---------------->
	<div class="record_line" id="Marquee">
		<div id="">
			恭喜  159****3540  的用户抽中  <span id="gift_coupon">200元现金代金券</span>
		</div>
	</div>
	<!-------------底部声明-------------->
	<img class="rule_title" src="../wx/cj/choujiang2/img/rule_title.png">
	<div class="rule_text">
		<p>1、活动期间，每日签到可获得一次抽奖机会，成功下单并确认签收后增加一次抽奖机会。</p>
                <p>2、如抽中一二三等奖与参与奖，均以喵券的形式直接派发，中奖领取后在有效期时间内下单即可使用，过期自动失效不予补发；</p>
                <p>3、如抽中特等奖上海迪士尼门票，需在中奖后的7个工作日内联系淘喵喵客服，选定15天以内的指定一天作为入园日期，并提供身份证信息等所需资料，届时凭身份证入园。如超过以上规定期限视为自动放弃机会，不予任何其他形式补偿。不可转让或以其他形式牟利，一经发现取消中奖资格。</p>

	</div>
</div>

<!-------------中奖弹窗页面-------------->
<div class="zj-main" id="zj-main">
		<div class="txzl">
			<div class="zj_text">
				中奖啦<br>恭喜获得<span id="jiangpin"></span>一份<br>可在我的券包中查看
			</div>
			<div class="close_zj">关闭</div>
		</div>
</div>

<!-------------谢谢参与弹窗-------------->
<div class="xxcy-main" id="xxcy-main">
	<div class="xxcy">
		<div class="xxcy_text">
			很遗憾<br>没有抽中礼品
		</div>   
		<div class="close_xxcy">关闭</div>
	</div>
</div>

<script type="text/javascript" src="/../wx/cj/choujiang2/js/jquery.min.js"></script>
<script type="text/javascript" src="../wx/cj/choujiang2/js/mui.min.js"></script>
<script type="text/javascript" src="../wx/cj/choujiang2/js/awardRotate.js"></script>
<!--<script type="text/javascript" src="../wx/cj/choujiang2/js/main.js"></script>-->
<script type="text/javascript" src="../wx/cj/choujiang2/js/award.js"></script>

<script type="text/javascript">
$(function(){
$("img").on("click",function(){
	return false;
});
document.addEventListener("WeixinJSBridgeReady",function(){
	WeixinJSBridge.call('hideOptionMenu'); 
});
});
</script>
<script>
	
$(document).ready(function(){

	setTimeout(start,stoptime);

	//动态添加大转盘的奖品与奖品区域背景颜色
	var num=location.hash;//根据接收过来的值判断概率。
	//	alert(num.substr(1));
	#for(x:PRIZELIST)
	      turnplate.restaraunts[#(for.index)] ="#(x.prize_name)";
	#end
	turnplate.colors = ["#FBDB00", "#FACA00", "#FBDB00", "#FACA00","#FBDB00", "#FACA00","#FBDB00","#FACA00","#FFEB64"];
	//turnplate.fontcolors = ["#CB0030", "#FFFFFF", "#CB0030", "#FFFFFF","#CB0030", "#FFFFFF"];
	
	var rotateTimeOut = function (){
		$('#wheelcanvas').rotate({
			angle:0,
			animateTo:2160,
			duration:6000,
			callback:function (){
				alert('网络超时，请检查您的网络设置！');
			}
		});
	};
	
	
	//旋转转盘 item:奖品位置; txt：提示语;
	var rotateFn = function (item, txt,data){
		var angles = item * (360 / turnplate.restaraunts.length) - (360 / (turnplate.restaraunts.length*2));
		if(angles<270){
			angles = 270 - angles; 
		}else{
			angles = 360 - angles + 270;
		}
		$('#wheelcanvas').stopRotate();
		$('#wheelcanvas').rotate({
			angle:0,
			animateTo:angles+1800,
			duration:6000,
			callback:function (){
				
				//中奖页面与谢谢参与页面弹窗
				if(txt.indexOf("谢谢参与")>=0){
					$(".xxcy_text").html(data.msg);
					$("#xxcy-main").fadeIn();
					save();
				}else{
					$("#zj-main").fadeIn();
					var resultTxt=txt.replace(/[\r\n]/g,"");//去掉回车换行
					$("#jiangpin").text(data.msg);
					save();
				}								
				turnplate.bRotate = !turnplate.bRotate;
			}
		});
	};
	
	/********弹窗页面控制**********/
	
	$('.close_zj').click(function(){
		window.location.reload();
		$('#zj-main').fadeOut();
		$('#tx-main').fadeIn();//提醒框显示
		//判断用户是否确认放弃
		$(".do").click(function(){//点确认就默认放弃
			$('#tx-main').fadeOut();
			theEnd();
			save();
		});
		$(".not_do").click(function(){//点取消就回到提交页面
			$('#tx-main').fadeOut();
			$('#zj-main').fadeIn();
		});

		$('#ml-main').fadeIn();
		
	});
	
	$('.close_xxcy').click(function(){
		$('#xxcy-main').fadeOut();
		window.location.reload();
//		theEnd();
//		save();
	});
	
	/********抽奖开始**********/
	$('#tupBtn').click(function (){
		var gamed = $("#gamed").val();
		var gameState = $("#gameState").val();
		var cardCode = $("#cardCode").val();
		var mId = $("#mId").val();
//		if(gameState != 0){
//			$(".xxcy_text").html("活动时间：01.13-03.04");
//			$("#xxcy-main").fadeIn();
//			return;	
//		}
		if(gamed == 1){
			$(".xxcy_text").html("今日抽奖次数已用完<br>每天分享可以增加一次抽奖机会");
			$("#xxcy-main").fadeIn();
			return;
		}
		if(turnplate.bRotate)return;
		turnplate.bRotate = !turnplate.bRotate;
//		var item = 1;
//		var data = {"msg":"谢谢参与"};
//		rotateFn(item, turnplate.restaraunts[item-1],data);
		$.ajax({
			type: "GET",
             url: "../marketingController/getAwards",
             data: {USER_CODE:#(USER.USER_CODE), PARTY_ID:#(PARTY_ID)},
             dataType: "json",
             async: false ,
			success:function(data){
				
//           nums = nums -1;
//           $('.nums').text(nums);
                item = 1;
//           	 if(turnplate.bRotate)return;
             	 
				turnplate.bRotate = !turnplate.bRotate;
				rotateFn(item, turnplate.restaraunts[item-1],0);
//           if(data.msg == "SUCCESS"){
//           	 item = turnplate.restaraunts.indexOf(data.data.prize_name)+1;
//           	 if(turnplate.bRotate)return;
//           	 
//				turnplate.bRotate = !turnplate.bRotate;
//				rotateFn(item, turnplate.restaraunts[item-1],0);
//           } else if(data.data!=null){
//           	 item = turnplate.restaraunts.indexOf(data.data.prize_name)+1;
//           	 if(turnplate.bRotate)return;
//				 turnplate.bRotate = !turnplate.bRotate;
//				 if(data.data.prize_name=='谢谢参与'){
//				 	 rotateFn(item, data.msg,2);
//				 }else{
//				 	 rotateFn(item, data.msg,1);
//				 }
//				
//           }else{
//           	alert(data.msg);
//           }
			 
			},
			error:function(data){
				console.log("error:"+data);
				return;
			}
		});
	})
		
});
</script>
</body>
</html>
 #end
#@layout()